﻿<Window x:Class="MultiLanguage.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:infrastructure="clr-namespace:MultiLanguage.Infrastructure"
        Title="Temperature Converter" 
        Height="300" 
        Width="700"
        WindowStartupLocation="CenterScreen"
        SnapsToDevicePixels="True"
        Icon="ApplicationResources/Images/MC900441442.PNG"
        >
    <Grid>
        <Grid.Background>
            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" ColorInterpolationMode="SRgbLinearInterpolation">
                <GradientStop Offset="0" Color="AliceBlue"/>
                <GradientStop Offset="0.60" Color="RoyalBlue"/>
                <GradientStop Offset="0.9" Color="Navy"/>
            </LinearGradientBrush>
        </Grid.Background>
        <DockPanel>
            <Menu DockPanel.Dock="Top">
                <MenuItem Header="{Binding MenuFile}" IsEnabled="False"/>
                <MenuItem Header="{Binding MenuEdit}" IsEnabled="False"/>
                <MenuItem Header="{Binding MenuView}" IsEnabled="False"/>
                <MenuItem Header="Language:" IsEnabled="False" FontWeight="Bold"/>
                <ComboBox Width="200" ItemsSource="{Binding SupportedCultures}" IsSynchronizedWithCurrentItem="True" SelectedValue="{Binding SelectedCultureInfo}"/>
                <Expander Header="{Binding MenuHelp}" Name="HelpExpander"/>
            </Menu>
            <StatusBar DockPanel.Dock="Bottom">
                <TextBlock Text="{Binding StatusText}"></TextBlock>
            </StatusBar>
            <Grid DockPanel.Dock="Top">
                <Grid.Style>
                    <Style TargetType="Grid">
                        <Setter Property="Visibility" Value="Visible"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=HelpExpander, Path=IsExpanded}" Value="True">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Style>
                <DockPanel>
                    <Rectangle DockPanel.Dock="Top" Height="20"/>
                    <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center" >
                        <StackPanel.Resources>
                            <Style TargetType="Rectangle">
                                <Setter Property="Visibility" Value="Collapsed"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding HasError}" Value="False">
                                        <Setter Property="Visibility" Value="Visible"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </StackPanel.Resources>
                        <TextBox 
                        IsTabStop="True"
                        Width="100" 
                        TextAlignment="Right" 
                        VerticalAlignment="Center"
                        VerticalContentAlignment="Center"
                        Text="{Binding InputTemperature, 
                        UpdateSourceTrigger=PropertyChanged, 
                        ValidatesOnDataErrors=True}"
                        MaxLength="12"
                        UndoLimit="0"
                        IsUndoEnabled="False"
                        ToolTip="{Binding InputTemperatureToolTip}"
                        infrastructure:MouseDownExtension.MouseDownSelectAll=""
                        />
                        <Rectangle Width="10"/>
                        <ToggleButton 
                    Name="DirectionalToggleButton" 
                    Width="200" 
                    Height="24" 
                    IsChecked="{Binding IsDirectionalToggleChecked}"
                    ToolTip="{Binding DirectionalToolTip}"
                    >
                            <ToggleButton.Style>
                                <Style TargetType="ToggleButton">
                                    <Setter Property="Content" Value="{Binding CelsiusToFahrenheit}"/>
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                    <Style.Triggers>
                                        <DataTrigger  Binding="{Binding ElementName=DirectionalToggleButton, Path=IsChecked}" Value="True">
                                            <Setter Property="Content" Value="{Binding FahrenheitToCelsius}"/>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding HasError}" Value="False">
                                            <Setter Property="Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </ToggleButton.Style>
                        </ToggleButton>
                        <Rectangle Width="10"/>
                        <TextBlock Text="{Binding OutputTemperature}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" MaxWidth="90">
                            <TextBlock.Style>
                                <Style TargetType="TextBlock">
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding HasError}" Value="False">
                                            <Setter Property="Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                        <Rectangle Width="3"/>
                        <TextBlock Text="{Binding DegreesText}" VerticalAlignment="Center" Width="70">
                            <TextBlock.Style>
                                <Style TargetType="TextBlock">
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding HasError}" Value="False">
                                            <Setter Property="Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                    </StackPanel>
                    <Rectangle DockPanel.Dock="Top" Height="20"/>
                    <StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center" Height="50">
                        <Image>
                            <Image.Style>
                                <Style TargetType="Image">
                                    <Setter Property="Source" Value="ApplicationResources/Images/Anders_Celsius.jpg"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ElementName=DirectionalToggleButton, Path=IsChecked}" Value="True" >
                                            <Setter Property="Source" Value="ApplicationResources/Images/daniel-fahrenheit_600.jpg"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Image.Style>
                        </Image>
                    </StackPanel>
                    <Rectangle DockPanel.Dock="Top"/>
                </DockPanel>
            </Grid>
            <Grid DockPanel.Dock="Top">
                <Grid.Style>
                    <Style TargetType="Grid">
                        <Setter Property="Visibility" Value="Collapsed"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=HelpExpander, Path=IsExpanded}" Value="True">
                                <Setter Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Style>
                <DockPanel>
                    <DockPanel.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="HorizontalAlignment" Value="Center"/>
                            <Setter Property="DockPanel.Dock" Value="Top"/>
                        </Style>
                    </DockPanel.Resources>
                    <TextBlock Text="Temperature Converter" FontSize="32"/>
                    <TextBlock Text="Release 1.0" FontSize="28"/>
                    <TextBlock Text="Garry Vass" FontSize="24"/>
                    <TextBlock Text="0777 067 3420" FontSize="20"/>
                    <TextBlock Text="garry2005@vassfamily.com" FontSize="16"/>
                </DockPanel>
            </Grid>
        </DockPanel>
    </Grid>
</Window>
